
# conversation = [
#     {
#         "role": "user",
#         "content": [
#             {"type": "image"},
#             {"type": "text", "text": "What is shown in this image?"},
#         ],
#     },
# ]

class ContentText:

    def __init__(self, text: str) -> None:
        self.text = text
    
    def to_dict(self) -> dict:
        return {"type": "text", "text": self.text}


class ContentImage:
    
    def __init__(self, image_path: str) -> None:
        self.image_path = image_path
    
    def to_dict(self) -> dict:
        return {"type": "image"}


class Content:

    def __init__(self, role:str, content: list) -> None:
        self.role = role
        self.content = content
    
    def to_dict(self) -> dict:
        return {
            "role": self.role,
            "content": [c.to_dict() for c in self.content]
        }
    
    def get_image_path_list(self) -> list:
        return [c.image_path for c in self.content if isinstance(c, ContentImage)]
    
    def AddText(self, text: str) -> None:
        self.content.append(ContentText(text))
    
    def AddImage(self, image_path: str) -> None:
        self.content.append(ContentImage(image_path))

